﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InnovTech.Persistence.NHibernate.Test.TestObjects
{
    public class TestEnvironment : NHVirtualEnvironmentBase<TestDababaseInfo>
    {

        public TestEnvironment(ISessionFactoryBuilder<TestDababaseInfo> sessionFactoryBuilder)
            : base(sessionFactoryBuilder)
        {
        }

        protected override void Cleanup(TestDababaseInfo databaseInfo)
        {
            string dbPath = Path.Combine(Directory.GetCurrentDirectory(), databaseInfo.DBPath);

            if (File.Exists(dbPath))
                File.Delete(dbPath);
        }

        protected override NHDatabaseGeneratorBase<TestDababaseInfo> CreateDatabaseGenerator(ISessionFactoryBuilder<TestDababaseInfo> _sessionFactoryBuilder)
        {
            TestGenerator gen = new TestGenerator(_sessionFactoryBuilder);
            return gen;
        }
    }
}
